const http = uni.$u.http
// 账密登录
export const signIn = (params, config = {}) => http.get('/system/app/user/signIn', params, config)

// 微信登陆
export const wxLogin = (openid) => http.post(`/system/app/user/login?openId=${openid}`)

// 通过code获取  openid
export const getOpenId = (params, config = {}) => http.get(`/app/user/login`, params, config)

// GET/app/login/findUserInfo【app】【查询用户信息详情】
export const findUserInfo = () => http.get(`/app/user/getInfo`)

// 修改个人信息
export const getUserInfo = () => http.get('/app/user/getInfo')

// 分类 /app/product/sort/getList
export const getSortList = (params, config = {}) => http.get('/app/product/sort/getList', {
	params
}, config)

// 产品 /app/product/list
export const getProductList = (params, config = {}) => http.get('/app/product/list', {
	params
}, config)

// /app/shoppingCart/joinInCart 加入购物车
export const joinInCart = (params, config = {}) => http.get('/app/shoppingCart/joinInCart', {
	params
}, config)

// /app/product/{id} 产品详情
export const getProductById = (id) => http.get(`/app/product/${id}`);
export const getProductInfo = (id) => http.get(`/app/product/${id}`);

// /app/shoppingCart/list 购物车列表
export const getCartList = () => http.get(`/app/shoppingCart/list`);

// /app/shoppingCart/updateShoppingCartNum 修改购物车数量
export const putCart = (params, config = {}) => http.get('/app/shoppingCart/updateShoppingCartNum',
	params, config)

// /app/shoppingCart/{ids} DELETE
export const delCart = (ids) => http.delete(`/app/shoppingCart/${ids}`);

// /app/order/createOrder 创建订单
export const createOrder = (params, config = {}) => http.post('/app/order/createOrder', params, config)

// /app/address/list
export const getAddressList = () => http.get(`/app/address/list`);
// /app/address
export const addAddress = (params, config = {}) => http.post('/app/address', params, config)
// /app/address/{id} 修改地址
export const putAddress = (params, config = {}) => http.put(`/app/address`, params, config)
// /app/address/{id} 删除地址
export const delAddress = (id) => http.delete(`/app/address/${id}`);
// /app/address/{id} 获取地址详情
export const getAddressInfo = (id) => http.get(`/app/address/${id}`);
// /app/address/parseAddress
export const analysisAddress = (params, config = {}) => http.post('/app/address/parseAddress',
	params, config)

// /app/shoppingCart/getNum 购物车数量
export const getCartNum = () => http.get(`/app/shoppingCart/getNum`);

// /app/order/getList
export const getOrderListByUser = (params, config = {}) => http.get('/app/order/getList',
	params, config)

// /app/order/cancelOrder/{id}
export const cancelOrder = (id) => http.get(`/app/order/cancelOrder/${id}`);

// /app/order/{id}
export const getOrderListDetails = (id) => http.get(`/app/order/${id}`);
export const getShopInfo = (id) => http.get(`/app/order/${id}`);

// /app/order/receive/{orderId} 确认收货
export const confirmOrder = (orderId) => http.get(`/app/order/receive/${orderId}`);

// 收藏 商品 /app/product/record/record/{productId}
export const collectProduct = (productId) => http.get(`/app/product/record/record/${productId}`);

// /app/product/record/list 足迹
export const getFootprintList = (params) => http.get(`/app/product/record/list`, {
	params
});

// 添加客户 /app/customer
export const addCustomer = (params, config = {}) => http.post('/app/customer', params, config)

// /app/customer 修改
export const putCustomer = (params, config = {}) => http.put('/app/customer', params, config)

// /app/customer/{id}
export const getCustomerById = (id) => http.get(`/app/customer/${id}`);

// /app/customer/list 客户列表
export const getCustomerList = (params) => http.get(`/app/customer/list`, {
	params
});

// /app/customer/{ids} delete
export const delCustomer = (ids) => http.delete(`/app/customer/${ids}`);

// /app/team 添加团队
export const addTeam = (params, config = {}) => http.post('/app/team', params, config)

// /app/team/{id} 修改团队
export const putTeam = (params, config = {}) => http.put('/app/team', params, config)

// /app/team/{id} 删除团队
export const delTeam = (id) => http.delete(`/app/team/${id}`);

// /app/team/list 团队列表
export const getTeamList = (params) => http.get(`/app/team/list`, {
	params
});

// /app/team/{id} 团队详情
export const getTeamInfo = (id) => http.get(`/app/team/${id}`);

// /app/balance/log/list 余额明细
export const getIntegralList = (params) => http.get(`/app/balance/log/list`, {
	params
});

// /app/user/bindPhone
export const bindPhone = (params, config = {}) => http.get('/app/user/bindPhone', params, config)

// /app/user/updateInfo
export const updateInfo = (params, config = {}) => http.post('/app/user/updateInfo', params, config)

///app/comment/comment 评价
export const comment = (params, config = {}) => http.post('/app/comment/comment', params, config)

// /app/comment/getList
export const getCommentList = (params) => http.get(`/app/comment/getList`, {
	params
})